<% layout('/layouts/default.html', {title: '客户处方表管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('客户处方表管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('custom:tcusPresc:edit')){ %>
					<a href="${ctx}/custom/tcusPresc/form" class="btn btn-default btnTool" title="${text('新增客户处方表')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn-setting" id="btnSetting" title="${text('设置')}"><i class="fa icon-settings"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${tcusPresc}" action="${ctx}/custom/tcusPresc/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('处方开立时间')}：</label>
					<div class="control-inline">
						<#form:input path="businessDate" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建医生工号')}：</label>
					<div class="control-inline">
						<#form:input path="createDrId" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('创建医生姓名')}：</label>
					<div class="control-inline">
						<#form:input path="createDrName" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('处方编号')}：</label>
					<div class="control-inline">
						<#form:input path="prescNum" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户id')}：</label>
					<div class="control-inline">
						<#form:input path="cusId" maxlength="32" class="form-control width-120"/>
					</div>
				</div>
			<div class="form-group">
				<label class="control-label">${text('删除标识')}：</label>
				<div class="control-inline width-120">
					<#form:select path="delFlag" dictType="del_flag" blankOption="true" class="form-control"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">${text('停用标识')}：</label>
				<div class="control-inline width-120">
					<#form:select path="stopFlag" dictType="stop_flag" blankOption="true" class="form-control"/>
				</div>
			</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
//# // 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $('#searchForm'),
	columnModel: [
		// {header:'${text("update_date")}', name:'updateDate', index:'a.update_date', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
		// 	return '<a href="${ctx}/custom/tcusPresc/form?tid='+row.tid+'" class="btnList" data-title="${text("编辑客户处方表")}">'+(val||row.id)+'</a>';
		// }},
		{header:'${text("处方开立时间")}', name:'businessDate', index:'a.business_date', width:150, align:"center"},
		{header:'${text("创建医生工号")}', name:'createDrId', index:'a.create_dr_id', width:150, align:"left"},
		{header:'${text("创建医生姓名")}', name:'createDrName', index:'a.create_dr_name', width:150, align:"left"},
		{header:'${text("处方编号")}', name:'prescNum', index:'a.presc_num', width:150, align:"left"},
		{header:'${text("客户id")}', name:'cusId', index:'a.cus_id', width:150, align:"left"},
		{header:'${text("删除标识")}', name:'delFlag', index:'a.del_flag', width:150, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel("#{@DictUtils.getDictListJson('del_flag')}", val, '${text("未知")}', true);
			}},
		{header:'${text("停用标识")}', name:'stopFlag', index:'a.stop_flag', width:150, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel("#{@DictUtils.getDictListJson('stop_flag')}", val, '${text("未知")}', true);
			}},
		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
			var actions = [];
			//# if(hasPermi('custom:tcusPresc:edit')){
				actions.push('<a href="${ctx}/custom/tcusPresc/form?tid='+row.tid+'" class="btnList" title="${text("编辑客户处方表")}"><i class="fa icon-note"></i></a>&nbsp;');
				if (row.status == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/custom/tcusPresc/disable?tid='+row.tid+'" class="btnList" title="${text("停用客户处方")}" data-confirm="${text("确认要停用该客户处方表吗？")}"><i class="fa icon-ban"></i></a>&nbsp;');
				} else if (row.status == Global.STATUS_DISABLE){
					actions.push('<a href="${ctx}/custom/tcusPresc/enable?tid='+row.tid+'" class="btnList" title="${text("启用客户处方")}" data-confirm="${text("确认要启用该客户处方表吗？")}"><i class="fa icon-check"></i></a>&nbsp;');
				}
				actions.push('<a href="${ctx}/custom/tcusPresc/delete?tid='+row.tid+'" class="btnList" title="${text("删除客户处方")}" data-confirm="${text("确认要删除该客户处方表吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			//# }
			return actions.join('');
		}}
	],
	//# // 加载成功后执行事件
	ajaxSuccess: function(data){
	}
});
</script>